package com.franklin.ideaplugin.api.beans;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson2.annotation.JSONType;
import com.franklin.ideaplugin.api.json.fastjson2.EnumClassSerializer;
import com.intellij.psi.PsiClass;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 枚举类
 *
 * @author Ye Junhui
 * @since 2023/5/25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@JSONType(serializer = EnumClassSerializer.class)
public class EnumClass implements IMultiValueJsonBean{

    /**
     * 类全称
     */
    private String qualifiedName;

    /**
     * 枚举值列表
     */
    private List<String> enumList;

    @Override
    public String toString() {
        return "EnumClass{" +
                "qualifiedName='" + qualifiedName + '\'' +
                '}';
    }

    @Override
    public String getDefaultValue(){
        if (CollectionUtil.isEmpty(enumList)){
            return "";
        }
        return enumList.get(0);
    }
}
